package com.csii.adhoc.controller.operationLog;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.csii.adhoc.annotation.OperationLog;
import com.csii.adhoc.operationLog.service.OperationLogService;
import com.csii.result.APIResult;
import com.csii.result.PageVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;

import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @description: 操作日志
 * @author: panChuanJiang
 * @create: 2021-01-19 09:40
 */
@RestController
@Slf4j
@RequestMapping("/operationLog")
public class OperationLogController {
    @Autowired
    private OperationLogService operationLogService;

    @PostMapping("selectPageLog")
    public APIResult<?> selectPageLog(@RequestParam(defaultValue = "1") int pageNo, @RequestParam(defaultValue = "10") int pageSize){
        Page<OperationLog> page = new Page<>(pageNo, pageSize);
        IPage<OperationLog> operationLogIPage = operationLogService.selectPageLog(page);
        return APIResult.successResult(PageVo.getPageVoFromIPage(operationLogIPage));
    }
}
